package com.taobao.txc.resourcemanager.b;

import com.taobao.txc.common.LoggerInit;
import com.taobao.txc.common.LoggerWrap;
import com.taobao.txc.common.TxcContext;
import com.taobao.txc.common.j;
import com.taobao.txc.parser.struct.TxcRuntimeContext;
import com.taobao.txc.parser.struct.m;
import com.taobao.txc.resourcemanager.b.c.d;
import java.sql.Array;
import java.sql.Blob;
import java.sql.CallableStatement;
import java.sql.Clob;
import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.NClob;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.sql.SQLWarning;
import java.sql.SQLXML;
import java.sql.Savepoint;
import java.sql.Statement;
import java.sql.Struct;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.concurrent.Executor;

public abstract class a
  extends f
{
  private static final LoggerWrap d = LoggerInit.logger;
  
  public a(Connection paramConnection, com.taobao.txc.resourcemanager.b.a.b paramb)
  {
    super(paramConnection, paramb);
  }
  
  public void setAutoCommit(boolean paramBoolean)
  {
    if (paramBoolean == getAutoCommit()) {
      return;
    }
    if (d.c()) {
      d.debug(String.format("[%d] [%s] [%s] [set autocommit = %B]", new Object[] { Long.valueOf(TxcContext.d()), com.taobao.txc.resourcemanager.a.f.a(this), com.taobao.txc.resourcemanager.a.f.b(this), Boolean.valueOf(paramBoolean) }));
    }
    this.a.setAutoCommit(paramBoolean);
  }
  
  public void commit()
  {
    if (d.b()) {
      com.taobao.txc.common.a.a.a().c();
    }
    boolean bool = false;
    try
    {
      TxcRuntimeContext localTxcRuntimeContext1;
      if (TxcContext.inTxcTransaction())
      {
        localTxcRuntimeContext1 = c();
        if (!localTxcRuntimeContext1.h()) {
          c(localTxcRuntimeContext1.f());
        }
        localTxcRuntimeContext1.b(j.b(localTxcRuntimeContext1.a()));
        localTxcRuntimeContext1.a(m.a.a());
        if (localTxcRuntimeContext1.c().size() > 0) {
          com.taobao.txc.resourcemanager.a.f.a(this, localTxcRuntimeContext1);
        }
        d.info(String.format("[%d:%d] branch commit rt cost %d ms", new Object[] { Long.valueOf(TxcContext.d()), Long.valueOf(localTxcRuntimeContext1.b()), Long.valueOf(localTxcRuntimeContext1.g()) }));
        d.info(String.format("[%d] [%s] [%s] [commit()]", new Object[] { Long.valueOf(TxcContext.d()), com.taobao.txc.resourcemanager.a.f.a(this), com.taobao.txc.resourcemanager.a.f.b(this) }));
      }
      this.a.commit();
      bool = true;
      if (TxcContext.inTxcTransaction())
      {
        localTxcRuntimeContext1 = c();
        if (localTxcRuntimeContext1.h()) {
          try
          {
            a(true);
            if (d.b()) {
              d.a("tran.branch.end", new Object[] { TxcContext.getCurrentXid(), Long.valueOf(localTxcRuntimeContext1.b()), "commit1", "1", "1", Long.valueOf(com.taobao.txc.common.a.a.a().c()), "", "" });
            }
          }
          catch (Throwable localThrowable2)
          {
            if (d.b()) {
              d.a("tran.branch.end", new Object[] { TxcContext.getCurrentXid(), Long.valueOf(localTxcRuntimeContext1.b()), "commit1", "1", "0", Long.valueOf(com.taobao.txc.common.a.a.a().c()), "", localThrowable2.getMessage() });
            }
          }
        }
      }
    }
    catch (Throwable localThrowable1)
    {
      if (!bool) {
        this.a.rollback();
      }
      if (TxcContext.inTxcTransaction())
      {
        TxcRuntimeContext localTxcRuntimeContext2 = c();
        if (localTxcRuntimeContext2.h()) {
          try
          {
            a(bool);
            if (d.b()) {
              if (bool) {
                d.a("tran.branch.end", new Object[] { TxcContext.getCurrentXid(), Long.valueOf(localTxcRuntimeContext2.b()), "commit1", "1", "1", Long.valueOf(com.taobao.txc.common.a.a.a().c()), "", "" });
              } else {
                d.a("tran.branch.end", new Object[] { TxcContext.getCurrentXid(), Long.valueOf(localTxcRuntimeContext2.b()), "rollback", "1", "1", Long.valueOf(com.taobao.txc.common.a.a.a().c()), "", "" });
              }
            }
          }
          catch (Throwable localThrowable3)
          {
            if (bool) {
              d.a("tran.branch.end", new Object[] { TxcContext.getCurrentXid(), Long.valueOf(localTxcRuntimeContext2.b()), "commit1", "1", "0", Long.valueOf(com.taobao.txc.common.a.a.a().c()), "", localThrowable3.getMessage() });
            } else {
              d.a("tran.branch.end", new Object[] { TxcContext.getCurrentXid(), Long.valueOf(localTxcRuntimeContext2.b()), "rollback", "1", "0", Long.valueOf(com.taobao.txc.common.a.a.a().c()), "", localThrowable3.getMessage() });
            }
          }
        }
      }
      if ((localThrowable1 instanceof SQLException)) {
        throw ((SQLException)localThrowable1);
      }
      throw new SQLException(localThrowable1);
    }
    finally
    {
      this.c = null;
    }
  }
  
  public void rollback()
  {
    if (d.b()) {
      com.taobao.txc.common.a.a.a().c();
    }
    try
    {
      d.info(String.format("[%d] [%s] [%s] [rollback()]", new Object[] { Long.valueOf(TxcContext.d()), com.taobao.txc.resourcemanager.a.f.a(this), com.taobao.txc.resourcemanager.a.f.b(this) }));
      this.a.rollback();
      if (TxcContext.inTxcTransaction())
      {
        TxcRuntimeContext localTxcRuntimeContext1 = c();
        if (localTxcRuntimeContext1.h())
        {
          a(false);
          if (d.b()) {
            d.a("tran.branch.end", new Object[] { TxcContext.getCurrentXid(), Long.valueOf(localTxcRuntimeContext1.b()), "rollback", "1", "1", Long.valueOf(com.taobao.txc.common.a.a.a().c()), "", "" });
          }
        }
        d.info(String.format("[%s:%d] branch rollback rt cost %d ms", new Object[] { Long.valueOf(TxcContext.d()), Long.valueOf(localTxcRuntimeContext1.b()), Long.valueOf(localTxcRuntimeContext1.g()) }));
      }
    }
    catch (SQLException localSQLException)
    {
      if ((d.b()) && (TxcContext.inTxcTransaction()))
      {
        TxcRuntimeContext localTxcRuntimeContext2 = c();
        if (localTxcRuntimeContext2.h()) {
          d.a("tran.branch.end", new Object[] { TxcContext.getCurrentXid(), Long.valueOf(localTxcRuntimeContext2.b()), "rollback", "1", "0", Long.valueOf(com.taobao.txc.common.a.a.a().c()), "", localSQLException.getMessage() });
        }
      }
      throw localSQLException;
    }
    finally
    {
      this.c = null;
    }
  }
  
  public void rollback(Savepoint paramSavepoint)
  {
    this.a.rollback(paramSavepoint);
  }
  
  public Statement createStatement()
  {
    Statement localStatement = this.a.createStatement();
    com.taobao.txc.resourcemanager.b.c.e locale = new com.taobao.txc.resourcemanager.b.c.e(localStatement, this);
    return locale;
  }
  
  public Statement createStatement(int paramInt1, int paramInt2)
  {
    Statement localStatement = this.a.createStatement(paramInt1, paramInt2);
    com.taobao.txc.resourcemanager.b.c.e locale = new com.taobao.txc.resourcemanager.b.c.e(localStatement, this);
    return locale;
  }
  
  public Statement createStatement(int paramInt1, int paramInt2, int paramInt3)
  {
    Statement localStatement = this.a.createStatement(paramInt1, paramInt2, paramInt3);
    com.taobao.txc.resourcemanager.b.c.e locale = new com.taobao.txc.resourcemanager.b.c.e(localStatement, this);
    return locale;
  }
  
  public CallableStatement prepareCall(String paramString)
  {
    CallableStatement localCallableStatement = this.a.prepareCall(paramString);
    com.taobao.txc.resourcemanager.b.c.b localb = new com.taobao.txc.resourcemanager.b.c.b(localCallableStatement, this, paramString);
    return localb;
  }
  
  public CallableStatement prepareCall(String paramString, int paramInt1, int paramInt2)
  {
    CallableStatement localCallableStatement = this.a.prepareCall(paramString, paramInt1, paramInt2);
    com.taobao.txc.resourcemanager.b.c.b localb = new com.taobao.txc.resourcemanager.b.c.b(localCallableStatement, this, paramString);
    return localb;
  }
  
  public CallableStatement prepareCall(String paramString, int paramInt1, int paramInt2, int paramInt3)
  {
    CallableStatement localCallableStatement = this.a.prepareCall(paramString, paramInt1, paramInt2, paramInt3);
    com.taobao.txc.resourcemanager.b.c.b localb = new com.taobao.txc.resourcemanager.b.c.b(localCallableStatement, this, paramString);
    return localb;
  }
  
  public PreparedStatement prepareStatement(String paramString)
  {
    PreparedStatement localPreparedStatement = this.a.prepareStatement(paramString);
    d locald = new d(localPreparedStatement, this, paramString);
    return locald;
  }
  
  public PreparedStatement prepareStatement(String paramString, int paramInt)
  {
    PreparedStatement localPreparedStatement = this.a.prepareStatement(paramString, paramInt);
    d locald = new d(localPreparedStatement, this, paramString);
    return locald;
  }
  
  public PreparedStatement prepareStatement(String paramString, int[] paramArrayOfInt)
  {
    PreparedStatement localPreparedStatement = this.a.prepareStatement(paramString, paramArrayOfInt);
    d locald = new d(localPreparedStatement, this, paramString);
    return locald;
  }
  
  public PreparedStatement prepareStatement(String paramString, String[] paramArrayOfString)
  {
    PreparedStatement localPreparedStatement = this.a.prepareStatement(paramString, paramArrayOfString);
    d locald = new d(localPreparedStatement, this, paramString);
    return locald;
  }
  
  public PreparedStatement prepareStatement(String paramString, int paramInt1, int paramInt2)
  {
    PreparedStatement localPreparedStatement = this.a.prepareStatement(paramString, paramInt1, paramInt2);
    d locald = new d(localPreparedStatement, this, paramString);
    return locald;
  }
  
  public PreparedStatement prepareStatement(String paramString, int paramInt1, int paramInt2, int paramInt3)
  {
    PreparedStatement localPreparedStatement = this.a.prepareStatement(paramString, paramInt1, paramInt2, paramInt3);
    d locald = new d(localPreparedStatement, this, paramString);
    return locald;
  }
  
  public boolean isWrapperFor(Class<?> paramClass)
  {
    return this.a.isWrapperFor(paramClass);
  }
  
  public <T> T unwrap(Class<T> paramClass)
  {
    return this.a.unwrap(paramClass);
  }
  
  public void clearWarnings()
  {
    this.a.clearWarnings();
  }
  
  public void close()
  {
    try
    {
      this.a.close();
    }
    finally
    {
      this.c = null;
    }
  }
  
  public Array createArrayOf(String paramString, Object[] paramArrayOfObject)
  {
    return this.a.createArrayOf(paramString, paramArrayOfObject);
  }
  
  public Blob createBlob()
  {
    return this.a.createBlob();
  }
  
  public Clob createClob()
  {
    return this.a.createClob();
  }
  
  public NClob createNClob()
  {
    return this.a.createNClob();
  }
  
  public SQLXML createSQLXML()
  {
    return this.a.createSQLXML();
  }
  
  public Struct createStruct(String paramString, Object[] paramArrayOfObject)
  {
    return this.a.createStruct(paramString, paramArrayOfObject);
  }
  
  public boolean getAutoCommit()
  {
    return this.a.getAutoCommit();
  }
  
  public String getCatalog()
  {
    return this.a.getCatalog();
  }
  
  public Properties getClientInfo()
  {
    return this.a.getClientInfo();
  }
  
  public String getClientInfo(String paramString)
  {
    return this.a.getClientInfo(paramString);
  }
  
  public int getHoldability()
  {
    return this.a.getHoldability();
  }
  
  public DatabaseMetaData getMetaData()
  {
    return this.a.getMetaData();
  }
  
  public int getTransactionIsolation()
  {
    return this.a.getTransactionIsolation();
  }
  
  public Map<String, Class<?>> getTypeMap()
  {
    return this.a.getTypeMap();
  }
  
  public SQLWarning getWarnings()
  {
    return this.a.getWarnings();
  }
  
  public boolean isClosed()
  {
    return this.a.isClosed();
  }
  
  public boolean isReadOnly()
  {
    return this.a.isReadOnly();
  }
  
  public boolean isValid(int paramInt)
  {
    return this.a.isValid(paramInt);
  }
  
  public String nativeSQL(String paramString)
  {
    return this.a.nativeSQL(paramString);
  }
  
  public void releaseSavepoint(Savepoint paramSavepoint)
  {
    this.a.releaseSavepoint(paramSavepoint);
  }
  
  public void setCatalog(String paramString)
  {
    this.a.setCatalog(paramString);
  }
  
  public void setClientInfo(Properties paramProperties)
  {
    this.a.setClientInfo(paramProperties);
  }
  
  public void setClientInfo(String paramString1, String paramString2)
  {
    this.a.setClientInfo(paramString1, paramString2);
  }
  
  public void setHoldability(int paramInt)
  {
    this.a.setHoldability(paramInt);
  }
  
  public void setReadOnly(boolean paramBoolean)
  {
    this.a.setReadOnly(paramBoolean);
  }
  
  public Savepoint setSavepoint()
  {
    return this.a.setSavepoint();
  }
  
  public Savepoint setSavepoint(String paramString)
  {
    return this.a.setSavepoint(paramString);
  }
  
  public void setTransactionIsolation(int paramInt)
  {
    this.a.setTransactionIsolation(paramInt);
  }
  
  public void setTypeMap(Map<String, Class<?>> paramMap)
  {
    this.a.setTypeMap(paramMap);
  }
  
  public void setSchema(String paramString)
  {
    throw new com.taobao.txc.common.b.e();
  }
  
  public String getSchema()
  {
    throw new com.taobao.txc.common.b.e();
  }
  
  public void abort(Executor paramExecutor)
  {
    throw new com.taobao.txc.common.b.e();
  }
  
  public void setNetworkTimeout(Executor paramExecutor, int paramInt)
  {
    throw new com.taobao.txc.common.b.e();
  }
  
  public int getNetworkTimeout()
  {
    throw new com.taobao.txc.common.b.e();
  }
}


/* Location:           C:\Users\ibm\Downloads\txc-yun-sample (1)\txc-yun-sample\lib\txc-client-2.0.72.jar
 * Qualified Name:     com.taobao.txc.resourcemanager.b.a
 * JD-Core Version:    0.7.0.1
 */